﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FoundationLib.Ifc.Authorisation.Configuration;

namespace FoundationLib.Ifc.Authorisation
{
	/// <summary>
	/// An abstract base class for authorisation services.
	/// </summary>
	public abstract class AuthorisationService : IAuthorisationService
	{
		/// <summary>
		/// The authorisation service configuration
		/// </summary>
		private AuthorisationConfigElement configuration;

		/// <summary>
		/// Gets or sets the authorisation service configuration.
		/// </summary>
		public AuthorisationConfigElement Configuration
		{
			get { return configuration; }
			set { configuration = value; }
		}

		/// <summary>
		/// Creates a new <see cref="AuthorisationService"/> instance.
		/// </summary>
		public AuthorisationService()
		{
		}

		/// <summary>
		/// Authorises the user with the given credentials against the directory service.
		/// </summary>
		/// <returns>True if the user has been authorised successfully, false
		/// otherwise</returns>
		/// <param name="username">The username</param>
		/// <param name="password">The password</param>
		public abstract bool Authorise(string username, string password);
	}
}
